class Solution {
public:
    int wiggleMaxLength(vector<int>& nums) {
        int left=0,right=0;
        int count=0;
        for(int i=0;i<nums.size()-1;i++)
        {
            right=nums[i+1]-nums[i];
            //cout<<right<<"/";
            if(right==0)
            {
                continue;
            }
            if(left * right <= 0)
            {
                count++;
                left=right;
            }   
        }
        return count+1;
    }
};